added samples
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2008 / CSBrowserHelperObject / BHOInstaller.cs
blob7f698ffbe4c3b6a5db09e6e024f705bee061f074
1 /****************************** Module Header ******************************\
2 * Module Name: BHOInstaller.cs
3 * Project: CSBrowserHelperObject
4 * Copyright (c) Microsoft Corporation.
5 *
6 * The class BHOInstaller inherits the class System.Configuration.Install.Installer.
7 * The methods Install and Uninstall will be run when this application is being
8 * installed or uninstalled.
9 *
10 * This action has to be added the the custom actions of the installer to take effect.
12 * This source is subject to the Microsoft Public License.
13 * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
14 * All other rights reserved.
16 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
17 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
19 \***************************************************************************/
21 using System.ComponentModel;
22 using System.Configuration.Install;
23 using System.Runtime.InteropServices;
25 namespace CSBrowserHelperObject
27 [RunInstaller(true), ComVisible(false)]
28 public partial class BHOInstaller : Installer
30 public BHOInstaller()
32 InitializeComponent();
35 /// <summary>
36 /// This is called when installer's custom action executes and
37 /// registers the toolbar which is extending a bandobject, as COM server.
38 /// </summary>
39 /// <param name="stateSaver"></param>
40 public override void Install(System.Collections.IDictionary stateSaver)
42 base.Install(stateSaver);
45 RegistrationServices regsrv = new RegistrationServices();
46 if (!regsrv.RegisterAssembly(this.GetType().Assembly,
47 AssemblyRegistrationFlags.SetCodeBase))
49 throw new InstallException("Failed To Register for COM");
53 /// <summary>
54 /// This is called when installer's custom action executes and
55 /// registers the toolbar which is extending a bandobject, as COM server.
56 /// </summary>
57 /// <param name="stateSaver"></param>
58 public override void Uninstall(System.Collections.IDictionary savedState)
60 base.Uninstall(savedState);
61 RegistrationServices regsrv = new RegistrationServices();
62 if (!regsrv.UnregisterAssembly(this.GetType().Assembly))
64 throw new InstallException("Failed To Unregister for COM");